package org.eenie.cartoonist.api.book;

import org.eenie.cartoonist.model.BookDetailEntity;
import org.eenie.cartoonist.provider.OkHttpProvider;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;

/**
 * Created by Eenie on 2016/8/18 11:03.
 * Des：
 */

public class BookApi {

    BookService mService;
    private final String BASE_URL = "https://api.douban.com";

    public BookApi() {
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .client(OkHttpProvider.get())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        mService = retrofit.create(BookService.class);
    }


    public Observable<BookDetailEntity> fetBookDetailById(String id) {
        return mService.fetBookDetail(id);
    }





}
